package com.yh.ldzl.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.BasicService;
import com.yh.ldzl.domain.QcDefect;
import com.yh.ldzl.domain.QcIndex;
import com.yh.ldzl.mapper.QcIndexMapper;
import com.yh.ldzl.service.QcIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class QcIndexServiceImpl implements QcIndexService {

    @Autowired
    private QcIndexMapper qcIndexMapper;



    @Override
    public IPage<QcIndex> selectQcIndexList(String index_code,
                                            String index_name,
                                            String index_type,
                                            int pageNum,
                                            int pageSize) {
        Page<QcIndex> page = new Page<>(pageNum, pageSize);
        return qcIndexMapper.selectQcIndexList(page, index_code, index_name, index_type);

    }

    @Override
    public boolean insertQcIndex(QcIndex qcIndex) {
        qcIndex.setCreate_by(SecurityUtils.getUsername());
        return qcIndexMapper.insertQcIndex(qcIndex)>0;
    }

    @Override
    public boolean updateQcIndex(QcIndex qcIndex) {
        qcIndex.setUpdate_by(SecurityUtils.getUsername());
        return qcIndexMapper.updateQcIndex(qcIndex)>0;
    }

    @Override
    public boolean deleteQcIndex(List<Long> ids) {
        return qcIndexMapper.deleteQcIndex(ids)>0;
    }




}
